#include <vcl.h>
#pragma hdrstop
//---------------------------------------------------------------------------
#include "CPosteDLL.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
//---------------------------------------------------------------------------
__fastcall CPosteDLL::CPosteDLL(bool bOuvrirCompta)
{
  m_pfncSaisiePoste        = NULL;
  m_pfncCompteEstDansPoste = NULL;
  m_pfncGetFirstDetailLigne= NULL;
  m_pfncGetNextDetailLigne = NULL;
  m_pfncCloseDetailLigne   = NULL;
  m_pfncGetFirstCompte     = NULL;
  m_pfncGetNextCompte      = NULL;
  m_pfncCloseCompte        = NULL;
  m_pfncDeletePoste        = NULL;
  m_pfncDeleteGroupe       = NULL;
  m_pfncReprendrePostesFromTempDir = NULL;
  m_pfncReprendrePosteFromTempDir  = NULL;
  m_pfncOpenTables         = NULL;
  m_pfncCloseTables        = NULL;
  m_pfncGetParamPoste      = NULL;
  m_pfncSetParamPoste      = NULL;
  m_pfncGetIntitulePoste   = NULL;
  m_pfncMigrerPostesTmp    = NULL;
  m_pfncClearPrecalPostes  = NULL;
  m_pfncClearParametrageUnPoste = NULL;

  m_hinstPostes                    = ::LoadLibrary( "postes.dll");
  m_pfncSaisiePoste                = ( PSTSaisiePoste               )::GetProcAddress( m_hinstPostes, "POSTESSaisiePoste"); ASSERT( m_pfncSaisiePoste);
  m_pfncCompteEstDansPoste         = ( PSTCompteEstDansPoste        )::GetProcAddress( m_hinstPostes, "@POSTESCompteEstDansPoste$qqrrx17System@AnsiStringi"); ASSERT( m_pfncCompteEstDansPoste);
  m_pfncGetFirstDetailLigne        = ( PSTGetFirstDetailLigne       )::GetProcAddress( m_hinstPostes, "POSTESGetFirstDetailLigne"); ASSERT( m_pfncGetFirstDetailLigne);
  m_pfncGetNextDetailLigne         = ( PSTGetNextDetailLigne        )::GetProcAddress( m_hinstPostes, "POSTESGetNextDetailLigne"); ASSERT( m_pfncGetNextDetailLigne);
  m_pfncCloseDetailLigne           = ( PSTCloseDetailLigne          )::GetProcAddress( m_hinstPostes, "POSTESCloseDetailLigne"); ASSERT( m_pfncCloseDetailLigne);
  m_pfncGetFirstCompte             = ( PSTGetFirstCompte            )::GetProcAddress( m_hinstPostes, "POSTESGetFirstCompte"); ASSERT( m_pfncGetFirstCompte);
  m_pfncGetNextCompte              = ( PSTGetNextCompte             )::GetProcAddress( m_hinstPostes, "POSTESGetNextCompte"); ASSERT( m_pfncGetNextCompte);
  m_pfncCloseCompte                = ( PSTCloseCompte               )::GetProcAddress( m_hinstPostes, "POSTESCloseCompte"); ASSERT( m_pfncCloseCompte);
  m_pfncDeletePoste                = ( PSTDeletePoste               )::GetProcAddress( m_hinstPostes, "@POSTESDeletePoste$qqri"); ASSERT( m_pfncDeletePoste);
  m_pfncDeleteGroupe               = ( PSTDeleteGroupe              )::GetProcAddress( m_hinstPostes, "@POSTESDeleteGroupe$qqri"); ASSERT( m_pfncDeleteGroupe);
  m_pfncReprendrePostesFromTempDir = ( PSTReprendrePostesFromTempDir)::GetProcAddress( m_hinstPostes, "@POSTESReprendrePostesFromTempDir$qqrir6CBarre"); ASSERT( m_pfncReprendrePostesFromTempDir);
  m_pfncReprendrePosteFromTempDir  = ( PSTReprendrePosteFromTempDir)::GetProcAddress( m_hinstPostes, "@POSTESReprendrePosteFromTempDir$qqrir6CBarre"); ASSERT( m_pfncReprendrePosteFromTempDir);
  m_pfncOpenTables                 = ( PSTOpenTables                )::GetProcAddress( m_hinstPostes, "POSTESOpenTables"); ASSERT( m_pfncOpenTables);
  m_pfncCloseTables                = ( PSTCloseTables               )::GetProcAddress( m_hinstPostes, "POSTESCloseTables"); ASSERT( m_pfncCloseTables);
  m_pfncGetParamPoste              = ( PSTGetParamPoste             )::GetProcAddress( m_hinstPostes, "@POSTESGetParamPoste$qqrir17TParametragePoste"); ASSERT( m_pfncGetParamPoste);
  m_pfncSetParamPoste              = ( PSTSetParamPoste             )::GetProcAddress( m_hinstPostes, "@POSTESSetParamPoste$qqrirx17TParametragePoste"); ASSERT( m_pfncSetParamPoste);
  m_pfncExiste                     = ( PSTExiste                    )::GetProcAddress( m_hinstPostes, "@POSTESExiste$qqri"); ASSERT( m_pfncExiste);
  m_pfncGetIntitulePoste           = ( PSTGetIntitulePoste          )::GetProcAddress( m_hinstPostes, "@POSTESGetIntitulePoste$qqri"); ASSERT( m_pfncGetIntitulePoste);
  m_pfncMigrerPostesTmp            = ( PSTMigrerPostesTmp           )::GetProcAddress( m_hinstPostes, "@POSTESMigrerPostesTmp$qqrrx17System@AnsiString"); ASSERT( m_pfncMigrerPostesTmp);
  m_pfncClearPrecalPostes          = ( PSTClearPrecalPostes         )::GetProcAddress( m_hinstPostes, "ClearPrecalPostes"); ASSERT( m_pfncClearPrecalPostes);
  m_pfncClearParametrageUnPoste    = ( PSTClearParametrageUnPoste   )::GetProcAddress( m_hinstPostes, "@ClearParametrageUnPoste$qqri"); ASSERT( m_pfncClearParametrageUnPoste);

  m_bOuvrirCompta = bOuvrirCompta;
  OpenTables();
}
//---------------------------------------------------------------------------
__fastcall CPosteDLL::~CPosteDLL()
{
  CloseTables();
  ::FreeLibrary( m_hinstPostes);
}
//---------------------------------------------------------------------------
/*void __cdecl CPosteDLL::InitGroupesPostes( CBarre *pBarre, int nNbGroupes, ...)
{
  va_list lstGroupes;
  va_start( lstGroupes, nNbGroupes);
  m_pfncInitGroupesPostes( pBarre, nNbGroupes, lstGroupes);
  va_end( lstGroupes);
}*/
//---------------------------------------------------------------------------
